<?php

class TestModel extends CI_Model{

    function __construct()
    {
        parent::__construct();
    }

    public function getList($condition = array(), $page=0) {
        $offset = ($page-1)*4;
        $query = $this->db->where($condition)->limit(4,$offset)->get('test');
        return $query->result_array();
    }
    public function add($data = array()) {
        $this->db->insert('test', $data);
    }
    public function getone($condition = array()) {
        $query = $this->db->where($condition)->get('test');
        return $query->row_array();
    }
    public function update($condition = array(), $data = array()) {
        $this->db->where($condition)->update('test', $data);

    }

    public function del($condition = array()) {
        $this->db->delete('test', $condition);
    }

    public function getCount() {
        $re = $this->db->count_all_results('test');
        return $re;
    }

}